package kz.pompei.ifacer.model.widgets;

import java.io.PrintStream;
import java.util.UUID;

public class WidgetButton extends WidgetRect {
  public String caption = "Кнопка";
  
  @Override
  protected void printFields(int offset, PrintStream out) {
    super.printFields(offset, out);
    String s = space(offset);
    out.println(s + "<caption><![CDATA[" + caption + "]]></caption>");
  }
  
  public WidgetButton(UUID uuid) {
    super(uuid);
    init();
  }
  
  private void init() {
    width = 100;
    height = 50;
  }
  
  public WidgetButton() {
    super();
    init();
  }
  
  @Override
  public Widget copy() {
    WidgetButton ret = new WidgetButton(uuid);
    assignTo(ret);
    return ret;
  }
  
  @Override
  public void assignTo(Widget widget) {
    checkWidget(widget, getClass());
    super.assignTo(widget);
    WidgetButton w = (WidgetButton)widget;
    w.caption = caption;
  }
}
